<?php

namespace app\index\controller;

use think\Controller;

class Cart extends Common
{
    public function index()
    {
        (new Auth())->check();

        #获取购车数据
        $data= session('cart') ?  : [];
//        dump($data);

        return $this->template('cart',compact('data'));
    }
    public function ajaxupdateCart()
    {
        if (request()->isAjax())
        {
            $post = $_POST;
            $data =[
                'num' => $post['num'],
                'sid' =>$post['id']
            ];
            (new \houdunwang\Cart())->update($data);
            echo  1;
        }
    }
}
